﻿@model List<Order>
@{
    ViewData["Title"] = "通用方式订单页";
}

<div class="text-center">
    <table class="table">
        <thead>
            <tr>
                <th>编号</th>
                <th>名称</th>
                <th>价格</th>
                <th>状态</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
            @foreach (var order in Model)
            {
                <tr>
                    <td>@order.OrderNo</td>
                    <td>@order.OrderName</td>
                    <td>@order.Price</td>
                    <td>@order.OrderState</td>
                    @switch (order.OrderState)
                    {
                        case OrderState.OrderCreated:
                            <td>
                                <a class="btn btn-primary" href="@Url.Action("JumpPayment","Common",new {id=order.OrderId })">跳转支付</a>
                                <a class="btn btn-primary" href="@Url.Action("CancelOrder","Common",new {id=order.OrderId })">取消订单</a>
                            </td>
                            break;
                        case OrderState.OrderPendingPay:
                            <td>
                                <a class="btn btn-primary" href="@Url.Action("CompletePayment","Common",new {id=order.OrderId })">完成支付</a>
                                <a class="btn btn-primary" href="@Url.Action("CancelOrder","Common",new {id=order.OrderId })">取消订单</a>
                            </td>
                            break;
                        case OrderState.OrderPendingSend:
                            <td>
                                <a class="btn btn-primary" href="@Url.Action("CompleteSend","Common",new {id=order.OrderId })">完成配送</a>
                                <a class="btn btn-primary" href="@Url.Action("CancelOrder","Common",new {id=order.OrderId })">取消订单</a>
                            </td>
                            break;
                        case OrderState.OrderPendingSign:
                            <td>
                                <a class="btn btn-primary" href="@Url.Action("CompleteSign","Common",new {id=order.OrderId })">完成收货</a>
                            </td>
                            break;
                        case OrderState.OrderPendingRefund:
                            <td>
                                <a class="btn btn-primary" href="@Url.Action("CompleteRefund","Common",new { id=order.OrderId })">完成退款</a>
                            </td>
                            break;
                        case OrderState.OrderInvalided:
                            <td>交易关闭</td>
                            break;
                        case OrderState.OrderCompleted:
                            <td>交易完成</td>
                            break;
                        default:
                            break;
                    }
                </tr>
            }
        </tbody>
    </table>
</div>
